﻿using System;
using System.IO;

using MbUnit.Framework;

namespace Abstract2ion.Tests
{
	public class ConsoleWrapperReadTestFixture
	{
		private ConsoleWrapper _consoleWrapper;

		[SetUp]
		public void Setup()
		{
			Console.SetIn(new StringReader("Test Content" + Environment.NewLine + "Other Content"));
			_consoleWrapper = new ConsoleWrapper();
		}

		[TearDown]
		public void Teardown()
		{
			Console.SetIn(new StreamReader(Console.OpenStandardInput()));
			Console.ResetColor();
		}

		[Test]
		public void ShouldReadCharacter()
		{
			Assert.AreEqual((int) 'T', _consoleWrapper.Read());
		}

		[Test]
		public void ShouldReadLine()
		{
			Assert.AreEqual("Test Content", _consoleWrapper.ReadLine());
		}
	}
}